<notempty name="announcements">
<div id="announcement" onmouseover="annstop = 1" onmouseout="annstop = 0">
	<div id="announcementbody">
	   <ul>
    	   <volist name="announcements" id="vo">
    	   <li><a href="{$vo.announce_id|format_announce_url=$vo['subject']}">{$vo.subject|Input::forShow}<em>({$vo.start_time|format_date='Y-m-d'})</em></a></li>
    	   </volist>
	   </ul>
	</div>
</div>
<script type="text/javascript">
var anndelay = 3000;
var annst = 0;
var annstop = 0;
var annrowcount = 0;
var anncount = 0;
var annlis = Q('announcementbody').getElementsByTagName("LI");
var annrows = new Array();
var annstatus;

function announcementScroll() {
	if(annstop) {
		annst = setTimeout('announcementScroll()', anndelay);
		return;
	}
	if(!annst) {
		var lasttop = -1;
		for(i = 0;i < annlis.length;i++) {

			if(lasttop != annlis[i].offsetTop) {
				if(lasttop == -1) {
					lasttop = 0;
				}
				annrows[annrowcount] = annlis[i].offsetTop - lasttop;
				annrowcount++;
			}
			lasttop = annlis[i].offsetTop;
		}

		if(annrows.length == 1) {
			Q('announcement').onmouseover = Q('announcement').onmouseout = null;
		} else {
			annrows[annrowcount] = annrows[1];
			Q('announcementbody').innerHTML += '<br style="clear:both" />' + Q('announcementbody').innerHTML;
			annst = setTimeout('announcementScroll()', anndelay);
		}
		annrowcount = 1;
		return;
	}

	if(annrowcount >= annrows.length) {
		Q('announcementbody').scrollTop = 0;
		annrowcount = 1;
		annst = setTimeout('announcementScroll()', anndelay);
	} else {
		anncount = 0;
		announcementScrollnext(annrows[annrowcount]);
	}
}

function announcementScrollnext(time) {
	Q('announcementbody').scrollTop++;
	anncount++;
	if(anncount != time) {
		annst = setTimeout('announcementScrollnext(' + time + ')', 10);
	} else {
		annrowcount++;
		annst = setTimeout('announcementScroll()', anndelay);
	}
}

announcementScroll();

</script>
</notempty>
